<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            margin: auto;
            text-align: center;
            position: relative;
        }
        #cul{
            position: absolute;
            top: 20px;
            right: 30px;
            font-size: 12px;
            color: blue;
            display: none;
        }
        ul li{
            width: 40px;
            height: 30px;
            list-style: none;
            border: 1px solid blue;
            line-height: 30px;
          
        }
        li:hover{
            cursor: pointer;
            background-color: skyblue;
        }
    </style>
</head>
<body>
    <div class="box">
        <button id="btn">输入法</button>
        <ul id="cul">
            <li>手写</li>
            <li>拼音</li>
            <li id="del">关闭</li>
        </ul>
    </div>
   
</body>
<script>
    var btn = document.getElementById('btn')
    var cul = document.getElementById('cul')
    var del = document.getElementById('del')

    btn.onclick =function(){
        cul.style.display = cul.style.display == "block"?"none":"block"
    }
    del.onclick =function(){
        cul.style.display = "none"
    }

</script>
</html>